<?php

/**
 * Iscritto form base class.
 *
 * @method Iscritto getObject() Returns the current form's model object
 *
 * @package    domande_bandi
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseIscrittoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                          => new sfWidgetFormInputHidden(),
      'username'                    => new sfWidgetFormInputText(),
      'password'                    => new sfWidgetFormInputText(),
      'nome'                        => new sfWidgetFormInputText(),
      'cognome'                     => new sfWidgetFormInputText(),
      'data_nascita'                => new sfWidgetFormDateTime(),
      'luogo_nascita'               => new sfWidgetFormInputText(),
      'prov_nascita'                => new sfWidgetFormInputText(),
      'citta_residenza'             => new sfWidgetFormInputText(),
      'provincia_residenza'         => new sfWidgetFormInputText(),
      'cap_residenza'               => new sfWidgetFormInputText(),
      'via_residenza'               => new sfWidgetFormInputText(),
      'civico_residenza'            => new sfWidgetFormInputText(),
      'citta_domicilio'             => new sfWidgetFormInputText(),
      'provincia_domicilio'         => new sfWidgetFormInputText(),
      'cap_domicilio'               => new sfWidgetFormInputText(),
      'via_domicilio'               => new sfWidgetFormInputText(),
      'civico_domicilio'            => new sfWidgetFormInputText(),
      'telefono_fisso'              => new sfWidgetFormInputText(),
      'telefono_cellulare'          => new sfWidgetFormInputText(),
      'email'                       => new sfWidgetFormInputText(),
      'pec'                         => new sfWidgetFormInputText(),
      'codice_fiscale'              => new sfWidgetFormInputText(),
      'tipo_doc_identita'           => new sfWidgetFormInputText(),
      'numero_doc_identita'         => new sfWidgetFormInputText(),
      'doc_identita_rilasciato_da'  => new sfWidgetFormInputText(),
      'cittadinanza'                => new sfWidgetFormInputText(),
      'godimento_diritti_politici'  => new sfWidgetFormInputCheckbox(),
      'iscrizione_liste_elettorali' => new sfWidgetFormInputCheckbox(),
      'ha_condanne_penali'          => new sfWidgetFormInputCheckbox(),
      'condanne_penali'             => new sfWidgetFormInputText(),
      'ha_procedimenti_penali'      => new sfWidgetFormInputCheckbox(),
      'procedimenti_penali'         => new sfWidgetFormInputText(),
      'idoneita_fisica'             => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'                          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'username'                    => new sfValidatorString(array('max_length' => 30)),
      'password'                    => new sfValidatorString(array('max_length' => 30)),
      'nome'                        => new sfValidatorString(array('max_length' => 50)),
      'cognome'                     => new sfValidatorString(array('max_length' => 50)),
      'data_nascita'                => new sfValidatorDateTime(array('required' => false)),
      'luogo_nascita'               => new sfValidatorString(array('max_length' => 100)),
      'prov_nascita'                => new sfValidatorString(array('max_length' => 2)),
      'citta_residenza'             => new sfValidatorString(array('max_length' => 100)),
      'provincia_residenza'         => new sfValidatorString(array('max_length' => 2)),
      'cap_residenza'               => new sfValidatorString(array('max_length' => 6)),
      'via_residenza'               => new sfValidatorString(array('max_length' => 100)),
      'civico_residenza'            => new sfValidatorInteger(),
      'citta_domicilio'             => new sfValidatorString(array('max_length' => 255)),
      'provincia_domicilio'         => new sfValidatorString(array('max_length' => 2)),
      'cap_domicilio'               => new sfValidatorString(array('max_length' => 6)),
      'via_domicilio'               => new sfValidatorString(array('max_length' => 255)),
      'civico_domicilio'            => new sfValidatorInteger(),
      'telefono_fisso'              => new sfValidatorString(array('max_length' => 20)),
      'telefono_cellulare'          => new sfValidatorString(array('max_length' => 20)),
      'email'                       => new sfValidatorString(array('max_length' => 50)),
      'pec'                         => new sfValidatorString(array('max_length' => 50)),
      'codice_fiscale'              => new sfValidatorString(array('max_length' => 16)),
      'tipo_doc_identita'           => new sfValidatorString(array('max_length' => 30)),
      'numero_doc_identita'         => new sfValidatorString(array('max_length' => 30)),
      'doc_identita_rilasciato_da'  => new sfValidatorString(array('max_length' => 50)),
      'cittadinanza'                => new sfValidatorString(array('max_length' => 50)),
      'godimento_diritti_politici'  => new sfValidatorBoolean(),
      'iscrizione_liste_elettorali' => new sfValidatorBoolean(),
      'ha_condanne_penali'          => new sfValidatorBoolean(),
      'condanne_penali'             => new sfValidatorString(array('max_length' => 255)),
      'ha_procedimenti_penali'      => new sfValidatorBoolean(),
      'procedimenti_penali'         => new sfValidatorString(array('max_length' => 255)),
      'idoneita_fisica'             => new sfValidatorBoolean(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'Iscritto', 'column' => array('username')))
    );

    $this->widgetSchema->setNameFormat('iscritto[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Iscritto';
  }

}
